/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pe.gob.pnp.actions;

import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import pe.gob.pnp.beans.PersonalPolicialBean;
import pe.gob.pnp.model.GestionPersonalPolicial;

/**
 *
 * @author gcarlos
 */
public class PersonaAction extends org.apache.struts.actions.DispatchAction {

    public ActionForward buscarAdministrado(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response)
            throws Exception {
        String destino = "jsonResultadoAdministrado";
        String cpersApepaterno = request.getParameter("cpersApepaterno").trim().equals("")?null:request.getParameter("cpersApepaterno").trim();
        String cpersApematerno = request.getParameter("cpersApematerno").trim().equals("")?null:request.getParameter("cpersApematerno").trim();
        String cpersNombre = request.getParameter("cpersNombre").trim().equals("")?null:request.getParameter("cpersNombre").trim();
        String cip = request.getParameter("cip").trim().equals("")?null:request.getParameter("cip").trim();
        String dni = request.getParameter("dni").trim().equals("")?null:request.getParameter("dni").trim();
        GestionPersonalPolicial gp = new GestionPersonalPolicial();
        List<PersonalPolicialBean> lstResultados = gp.obtenerPersonalPolicial(cpersApepaterno, cpersApematerno, cpersNombre, dni, cip);
        request.setAttribute("lstResultados", lstResultados);
        return mapping.findForward(destino);
    }
}
